VERSION 5.00 Begin VB.Form frmFind BorderStyle = 1 'Fixed Single Caption = " Find Text" ClientHeight = 2040 ClientLeft = 45 ClientTop = 330 ClientWidth = 4740 ClipControls = 0 'False LinkTopic = "Form1" LockControls = -1 'True MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 2040 ScaleWidth = 4740 ShowInTaskbar = 0 'False StartUpPosition = 3 'Windows Default WhatsThisButton = -1 'True WhatsThisHelp = -1 'True Begin VB.CheckBox Check2 Caption = "Case &Sensitive" Height = 375 Left = 240 TabIndex = 6 Top = 960 Width = 1455 End Begin VB.CheckBox Check1 Caption = "&Whole Word Only" Height = 375 Left = 240 TabIndex = 5 Top = 600 Width = 1575 End Begin VB.CommandButton cmdClose Cancel = -1 'True Caption = "&Close" Height = 375 Left = 3360 TabIndex = 4 Top = 1080 Width = 1215 End Begin VB.CommandButton cmdNext Caption = "Find &Next" Height = 375 Left = 3360 TabIndex = 3 Top = 600 Width = 1215 End Begin VB.CommandButton cmdFind Caption = "&Find" Height = 375 Left = 3360 TabIndex = 2 Top = 120 Width = 1215 End Begin VB.TextBox Text1 Height = 285 Left = 1320 MaxLength = 40 TabIndex = 1 Top = 120 Width = 1815 End Begin VB.Frame Frame1 Height = 975 Left = 120 TabIndex = 7 Top = 480 Width = 1815 End Begin VB.Label Label1 AutoSize = -1 'True Caption = "Find What:" BeginProperty Font Name = "MS Sans Serif" Size = 9.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 240 Left = 240 TabIndex = 0 Top = 120 Width = 945 End Attribute VB_Name = "frmFind" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Dim OriginalParenthWnd As Long Dim Position As Long Private Sub cmdClose_Click() Unload Me End Sub Private Sub cmdFind_Click() Dim FindFlags As Long On Error GoTo ErrorTrap Position = 0 FindFlags = Check1.Value * 2 + Check2.Value * 4 Position = frmOpenDoc.RichTextBox1.Find(Text1.Text, Position, , FindFlags) If Position >= 0 Then r = Text1.Text frmOpenDoc.SetFocus Text1.Text = r MsgBox "Document has finished searching the document." & Chr(13) & Chr(13) & Chr(34) & Text1.Text & Chr(34) & " was not found!" Text1.SetFocus Text1.SelStart = 0 Text1.SelLength = Len(Text1.Text) End If Exit Sub ErrorTrap: Call ErrorTrap End Sub Private Sub cmdNext_Click() Dim FindFlags As Long On Error GoTo ErrorTrap FindFlags = Check1.Value * 2 + Check2.Value * 4 Position = frmOpenDoc.RichTextBox1.Find(Text1.Text, Position + 1, , FindFlags) If Position > 0 Then p = Text1.Text frmOpenDoc.SetFocus Text1.Text = p MsgBox "Document has finished searching the document." & Chr(13) & Chr(13) & Chr(34) & Text1.Text & Chr(34) & " was not found!" Text1.SetFocus Text1.SelStart = 0 Text1.SelLength = Len(Text1.Text) End If Exit Sub ErrorTrap: Call ErrorTrap End Sub Private Sub Form_Load() frmOpenDochwnd = SetWindowLong(Me.hwnd, GWW_HWNDPARENT, frmOpenDoc.hwnd) Width = 0.4 * Screen.Width Height = 0.24 * Screen.Height Left = (Screen.Width - Width) / 2 Top = (Screen.Height - Height) / 2 End Sub Private Sub Form_Unload(Cancel As Integer) Dim r As Long r = SetWindowLong(Me.hwnd, GWW_HWNDPARENT, OriginalParenthWnd) End Sub